//
//  KMContext.h
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 ZHBen. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "KUIModule.h"
#import "KDDCollectionView.h"

@interface KMContext : NSObject

@property (readonly,strong,nonatomic) id<KDataDriven> dataDriven;

@property (readonly,strong,nonatomic) KDDCollectionView * collectionView;

@property (readonly,strong,nonatomic) NSArray<KUIModule *> * moduleList;

@property (nonatomic) BOOL updateImmediate;

@property (nonatomic) BOOL reloadNextUpdate;

///layout 必须是 KDDCollectionLayout 或者是其子类
+ (KMContext *)contextWithFrame:(CGRect)frame displayInsets:(UIEdgeInsets)displayInsets collectionViewLayout:(KDDCollectionLayout *)layout;

+ (KMContext *)contextWithFrame:(CGRect)frame displayInsets:(UIEdgeInsets)displayInsets;

- (void)setScrollDelegate:(id<UIScrollViewDelegate>)delegate;

- (void)appendModuleList:(NSArray<KUIModule *> *)moduleList;

- (void)insertModuleList:(NSArray<KUIModule *> *)moduleList atIndexes:(NSIndexSet *)indexSet;

- (void)deleteModuleListAtIndexes:(NSIndexSet *)indexSet;

- (void)modifyModuleList:(NSArray<KUIModule *> *)moduleList atIndexes:(NSIndexSet *)indexSet;

- (void)reloadModuleList:(NSArray<KUIModule *> *)moduleList;

- (BOOL)hasPendingUpdate;

@end
